

import java.util.*;




public class Driver {
    public static void main(String args[]){
        ReservationSystem reserve = new ReservationSystem();
        int choice = 0;
        int i = 0;
        Scanner scanner = new Scanner(System.in);
        do{
            System.out.println("===========================");
            System.out.println("RESTAURANT RESERVATION");
            System.out.println("===========================");
            System.out.println("1 - Reserve");
            System.out.println("2 - View all Reservation");
            System.out.println("3 - View all Reservation at specific date");
            System.out.println("4 - View All Reservation at specific date and time");
            System.out.println("5 - Exit");
            switch(choice = Integer.parseInt(scanner.nextLine())){
                case 1: 
                    System.out.println("Reserve");
                    Request request = new Request();
                    System.out.print("Name: ");
                    request.setName(scanner.nextLine());
                    System.out.print("Contact: ");
                    request.setContact(Integer.parseInt(scanner.nextLine()));
                    System.out.print("Date (MM/DD/YYYY): ");
                    request.setDate(scanner.nextLine());  
                    System.out.print("Time: ");
                    request.setTime(Integer.parseInt(scanner.nextLine()));
                    System.out.print("Number of People: ");
                    request.setNumofPeople(Integer.parseInt(scanner.nextLine()));
                    reserve.addRequest(request);
                    System.out.println("Pending Request");
                    break;
                case 2:
                	System.out.println("View All Reservation");
                	for(Request s: reserve.getRequests()){
                        System.out.println(s.info());
                	}
                	break;
                case 3:
                	System.out.println("View All Reservation at Specific Date");
                	System.out.println("Enter Date:");
	      			String check = scanner.next();
	      			System.out.println("View all reservation");
	      			for(int x=0; x<reserve.getRequests(check).size(); x++){
	      				System.out.println(reserve.getRequests(check).get(x)); 
	      			}
	      			break;
                case 4:
                	System.out.println("View All Reservation at Specific Date and Time");
                	System.out.print("From Date: ");
	      			String fromdate = scanner.next();
	      			System.out.print("To Date : ");
	      			int fromtime = scanner.nextInt();
	      			System.out.print("\nFrom Time: ");
	      			String todate = scanner.next();
	      			System.out.print("To Time: ");
	      			int totime = scanner.nextInt();
	      			for(int x=0; x < reserve.getRequests(fromdate, fromtime, 
	      					todate, totime).size(); x++){
	      				System.out.println(reserve.getRequests(fromdate, fromtime, 
	      						todate, totime).get(x)); 
	      			}
	      			
                	break;
                
            }
        }while(choice!=5);

    }
}

